# -*- coding:utf-8 -*-
import os , fnmatch

def all_files(root,patterns='*',single_level=False, yield_folder=False):
	"""docstring for all_files"""
	patterns = patterns.split(';')
	for path,subpath,filenames in os.walk(root):
		if yield_folder:
			filenames.extend(subpath)
		filenames.sort()
		for name in filenames:
			for pattern in patterns:
				if fnmatch.fnmatch(name,pattern):
						yield os.path.join(path,name)
						break
		if single_level:
			break

if __name__ == '__main__':
	files = all_files('D:\\vim\\vimfiles\\bundle\\nerdcommenter\\plugin','*')
	for path in files:
		print path
